//
//  DetailGoodShopModel.m
//  BTRIP
//
//  Created by johnbk on 15/11/13.
//  Copyright © 2015年 johnbk. All rights reserved.
//

#import "DetailGoodShopModel.h"
@class Story;
#import "Comments.h"
@implementation DetailGoodShopModel
- (void)dealloc
{	[_consumption_per_person release];
	[_url release];
	[_name release];
	[_slogan release];
	[_user_avatar release];
	[_user_nickname release];
	[_story release];
	[_phone release];
	[_shop_hours release];
	[_address release];
	[_coordinate release];
	[super dealloc];
}
- (void) setValue:(id)value forKey:(NSString *)key{
	if ([key isEqualToString:@"user"]) {
		self.user_avatar = [value objectForKey:@"avatar"];
		self.user_nickname = [value objectForKey:@"nickname"];
	}else if ([key isEqualToString:@"phone"]){
		self.phone = value[0];
	}
	else if ([key isEqualToString:@"cover"]){
		self.url = [value objectForKey:@"url"];
	}
	else if ([key isEqualToString:@"story"]){
		NSMutableArray *array = [NSMutableArray array];
		for (NSDictionary *dictionary in value) {
			
			Story *story = [[Story alloc]init];
			[story setValuesForKeysWithDictionary:dictionary];
			[array addObject:story];
			[story release];
	}
		self.story = array;
	}
	else if ([key isEqualToString:@"comments"]){
		NSMutableArray *array = [NSMutableArray array];
		for (NSDictionary *dictionary in value) {
			Comments *comments = [[Comments alloc]init];
			[comments setValuesForKeysWithDictionary:dictionary];
			[array addObject:comments];
			[comments release];
		}
		self.comments = array;

	}
	else{
		[super setValue:value forKey:key];
	}
	
}
@end
